package com.krisyu.builderPattern.example.builder;

import com.krisyu.builderPattern.example.product.BenzCar;
import com.krisyu.builderPattern.example.product.CarModel;

import java.util.ArrayList;
import java.util.List;

/**
 * @author KrisYu
 * @date 2022/12/17
 * @description
 */
public class BenzCarBuilder extends CarBuilder{
    private List<String> sequence = new ArrayList<>();

    @Override
    public CarBuilder withStart() {
        this.sequence.add("start");
        return this;
    }

    @Override
    public CarBuilder withAlarm() {
        this.sequence.add("alarm");
        return this;
    }

    @Override
    public CarBuilder withEngineBoom() {
        this.sequence.add("engineBoom");
        return this;
    }

    @Override
    public CarBuilder withStop() {
        this.sequence.add("stop");
        return this;
    }

    @Override
    public CarBuilder withSequence(List<String> sequence) {
        this.sequence = sequence;
        return this;
    }

    @Override
    public CarModel build() {
        BenzCar benzCar = new BenzCar();
        benzCar.setSequence(this.sequence);
        return benzCar;
    }
}
